﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.IO.IsolatedStorage;
using System.IO;
using System.Xml;

namespace RemoteGamePad
{
    public partial class MainPanorama : PhoneApplicationPage
    {
        public MainPanorama()
        {
            InitializeComponent();
        }

        private void GamepadButton_Click(object sender, RoutedEventArgs e)
        {
            PhoneApplicationFrame root = Application.Current.RootVisual as PhoneApplicationFrame;
            root.Navigate(new Uri("/Gamepad", UriKind.Relative));
        }

        private void GoButton_Click(object sender, RoutedEventArgs e)
        {
            //using (var appStorage = IsolatedStorageFile.GetUserStoreForApplication())

            //using (var file = appStorage.OpenFile("config.xml", FileMode.OpenOrCreate))
            //{

            //    XmlWriterSettings settings = new XmlWriterSettings();
            //    settings.Indent = true;
            //    using (XmlWriter writer = XmlWriter.Create(file, settings))
            //    {

            //        writer.WriteStartElement("c", "config", "urn:config");
            //        writer.WriteStartElement("Adress", "");
            //        writer.WriteString(ipAdressTextBlock.Text);
            //        writer.WriteEndElement();
            //        // Ends the document
            //        writer.WriteEndDocument();
            //        // Write the XML to the file.
            //        writer.Flush();
            //    }

            //}

            //var settings = IsolatedStorageSettings.ApplicationSettings;
            //settings.Add("adress", ipAdressTextBlock.Text);
        }

        private void hyperlinkButton2_Click(object sender, RoutedEventArgs e)
        {
            PhoneApplicationFrame root = Application.Current.RootVisual as PhoneApplicationFrame;
            root.Navigate(new Uri("/Mouse", UriKind.Relative));
        }
    }
}